﻿@model List<KRM.Core.tblOrderItemPhoto>
@{
    ViewBag.Title = "Order Item Photo";
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
}

<div style="padding: 5px 20px 20px 20px;">
    @Html.Partial("Partial/_MessageResult")
    <fieldset>
        <legend>Add photo</legend>
        <form action="/orderview/addorderitemphoto" method="POST" enctype="multipart/form-data" class="margin0">
            <input type="hidden" name="OrderItemId" value="@ViewBag.OrderItemId"/>
            <input type="hidden" name="OrderRef" value="@ViewBag.OrderRef"/>
            <div class="row-fluid">
                <div class="span2">Choose image</div>
                <div class="span6"><input type="file" name="PhotoSrc" required="required"/></div>
            </div>
            <div class="row-fluid" style="margin-top: 5px">
                <div class="span2"></div>
                <div class="span6">
                    <input type="submit" class="btn btn-primary span4" value="Add Photo"/>
                </div>
            </div>
        </form>
    </fieldset>
    <table class="table table-hover table-bordered table-fix" style=" font-size: 13px; margin-top: 20px">
        <thead>
            <tr>
                <th>ID</th>
                <th>Image</th>
                <th>OrderItemID</th>
                <th>PhotoID</th>
                <th>PhotoName</th>
                <th>PhotoSrc</th>
                <th>IsDriverManifests</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    
                    <td>@item.ID</td>
                    <td>
                        <img src="/rdm/getfile?path=@item.PhotoSrc" style="width: 120px;" alt="@item.PhotoName" />
                    </td>
                    <td>@item.OrderItemID</td>
                    <td>@item.PhotoId</td>
                    <td>@item.PhotoName</td>
                    <td>@item.PhotoSrc</td>
                    <td>@item.IsDriverManifests</td>
                    <td>
                        <a href="/orderview/editorderitemphoto/@item.ID?orderitemid=@item.OrderItemID&orderref=@ViewBag.OrderRef">Edit</a> | 
                        <a href="/orderview/deleteorderitemphoto/@item.ID?orderitemid=@item.OrderItemID&orderref=@ViewBag.OrderRef" onclick="javascript:return confirm('Are you sure?');">Delete</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>

